#!/usr/bin/env node
import { program } from "commander";
import queryProjectName from "./create.js";
import readUploadDir from "./upload.js";

const cliData = {
    version: "1.0.1",
    name: "gt-cli",
    author: "赵文昊",
    updateTime: "2024-06-14",
};

// 监听输入的命令
program
    .command("create <project-name>")
    .description("创建项目")
    .action(function (projectName) {
        queryProjectName(projectName);
    });
// 查询版本
program.option("-v, --version", "查询版本").action(function () {
    const { version, author, updateTime } = cliData;
    console.log("version：", version);
    console.log("author：", author);
    console.log("updateTime：", updateTime);
});

// 上传node_modules包
program
    .command("upload")
    .description("上传node_modules包")
    .action(function () {
        readUploadDir();
    });

program.parse(process.argv);
